﻿<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:vsm="clr-namespace:System.Windows;assembly=System.Windows"
    xmlns:ToolPanel="clr-namespace:DeepEarth.Client.Controls;assembly=DeepEarth.Client.Controls.ToolPanel">

    <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="/DeepEarth.Client.Controls.DEMap.Common;component/Resources/CommonStyles.xaml" />
    </ResourceDictionary.MergedDictionaries>

    <Style TargetType="ToolPanel:ToolPanel">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="ToolPanel:ToolPanel">
                    <Canvas x:Name="LayoutRoot" Opacity="0.82" Width="260" Height="25">
                        <vsm:VisualStateManager.VisualStateGroups>
                            <vsm:VisualStateGroup x:Name="CommonStates">
                                <vsm:VisualStateGroup.Transitions>
                                    <vsm:VisualTransition GeneratedDuration="00:00:00.3000000"/>
                                </vsm:VisualStateGroup.Transitions>
                                <vsm:VisualState x:Name="MouseOver">
                                    <Storyboard>
                                        <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="LayoutRoot" Storyboard.TargetProperty="(UIElement.Opacity)">
                                            <SplineDoubleKeyFrame KeyTime="00:00:00" Value="1"/>
                                        </DoubleAnimationUsingKeyFrames>
                                    </Storyboard>
                                </vsm:VisualState>
                                <vsm:VisualState x:Name="Normal">
                                    <Storyboard/>
                                </vsm:VisualState>
                            </vsm:VisualStateGroup>
                            <vsm:VisualStateGroup x:Name="OptionStates">
                                <vsm:VisualStateGroup.Transitions>
                                    <vsm:VisualTransition GeneratedDuration="00:00:00.6000000"/>
                                </vsm:VisualStateGroup.Transitions>
                                <vsm:VisualState x:Name="Open">
                                    <Storyboard>
                                        <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="OptionsFlyout" Storyboard.TargetProperty="(FrameworkElement.Height)">
                                            <SplineDoubleKeyFrame KeyTime="00:00:00" Value="100"/>
                                        </DoubleAnimationUsingKeyFrames>
                                        <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Duration="00:00:00.0010000" Storyboard.TargetName="OptionsFlyout" Storyboard.TargetProperty="(Canvas.Top)">
                                            <SplineDoubleKeyFrame KeyTime="00:00:00" Value="-98"/>
                                        </DoubleAnimationUsingKeyFrames>
                                    </Storyboard>
                                </vsm:VisualState>
                                <vsm:VisualState x:Name="Closed">
                                    <Storyboard/>
                                </vsm:VisualState>
                            </vsm:VisualStateGroup>
                        </vsm:VisualStateManager.VisualStateGroups>
                        <Border Width="260" Height="25" HorizontalAlignment="Stretch" Background="#FF2B2B2B" BorderBrush="#FF000000" BorderThickness="1,1,1,1" Canvas.ZIndex="2">
                            <ContentPresenter Margin="20,0,20,0" 
                                    Width="210"
                                    Content="{TemplateBinding Content}"
                                    ContentTemplate="{TemplateBinding ContentTemplate}" />
                        </Border>

                        <ContentControl Content="{StaticResource EndPath}" Canvas.Left="0" Height="25" RenderTransformOrigin="0.5,0.5" ContentTemplate="{StaticResource EndPath}" Canvas.ZIndex="3">
                            <ContentControl.RenderTransform>
                                <TransformGroup>
                                    <ScaleTransform ScaleX="1"/>
                                    <SkewTransform/>
                                    <RotateTransform Angle="180"/>
                                    <TranslateTransform/>
                                </TransformGroup>
                            </ContentControl.RenderTransform>
                        </ContentControl>

                        <ContentControl Content="{StaticResource EndPath}" Canvas.Left="245" Height="25" RenderTransformOrigin="0.5,0.5" ContentTemplate="{StaticResource EndPath}" Canvas.ZIndex="3">
                            <ContentControl.RenderTransform>
                                <TransformGroup>
                                    <ScaleTransform ScaleX="1"/>
                                    <SkewTransform/>
                                    <RotateTransform Angle="0"/>
                                    <TranslateTransform/>
                                </TransformGroup>
                            </ContentControl.RenderTransform>
                        </ContentControl>
                        
                        <Grid Height="0" x:Name="OptionsFlyout" Width="240" Margin="10,0,10,25" Canvas.ZIndex="1">
                            <Border HorizontalAlignment="Stretch" Margin="5,0,5,0" Background="#FF2B2B2B" BorderBrush="#FF000000" BorderThickness="1,1,1,1" VerticalAlignment="Stretch">
                                <ContentPresenter Margin="8,8,8,8"
                                    Content="{TemplateBinding Options}"
                                    ContentTemplate="{TemplateBinding OptionsTemplate}" />
                            </Border>
                        </Grid>
                    </Canvas>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
</ResourceDictionary>

